package com.mydemo.design_pattern.create_type.abstract_factory;

import com.mydemo.design_pattern.create_type.abstract_factory.impl.*;

/**
 * <p></p >
 *
 * @author liming1
 * @version $Id: ProducterFactory, v1.0 2019-09-18 10:07 liming1 Exp $
 */
public class Product2Factory extends AbstractFactory {

    @Override
    public IProduct1 createProduct1(String productName1) {
        return null;
    }

    @Override
    public IProduct2 createProduct2(String productName2) {
        if (productName2 == null) {
            return null;
        }
        if ("demo1".equals(productName2)) {
            return new Demo1Product2();
        } else if ("demo2".equals(productName2)) {
            return new Demo2Product2();
        } else if ("demo3".equals(productName2)) {
            return new Demo3Product2();
        }
        return null;
    }
}
